<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateFeatureComplainTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('feature_complain', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('orderId')->default(0)->comment("订单id");
            $table->unsignedInteger("shopId")->default(0)->comment("店铺id");
            $table->unsignedInteger('problemPid')->default(0)->comment('父级问题类型');
            $table->unsignedInteger('problemChildId')->default(0)->comment('子级问题类型');
            $table->string('reason', 50)->default('')->comment('投诉原因');
            $table->string("desc", 255)->default("")->comment("补充描述");
            $table->string("phone", 32)->default("")->comment("联系电话");
            $table->string('img', 1000)->default('')->comment('图片');
            $table->unsignedInteger('status')->default(0)->comment('状态 0未处理 1已完成');
            $table->string("remark", 255)->default("")->comment("客服备注");
            $table->unsignedInteger('completeTime')->default(0)->comment('完成时间戳');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('更新时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('更新人');

            $table->index(["orderId"], "orderIdIdx");
            $table->index(["shopId"], "shopIdIdx");
            $table->index(["createdAt"], "createdAtIdx");
            $table->index(["completeTime"], "completeTimeIdx");
            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '投诉建议表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('feature_complain');
    }
}
